package com.blank.net;

public class Response {

    public static final int CODE_SUCCESS = 200;
    public static final int CODE_FAIL = 400;
    public static final int CODE_UNAUTHORIZED = 401;
    public static final int CODE_EXCEPTION = 500;

    public static final String MSG_NEED_LOGIN = "请重新登录";
    public static final String MSG_NEED_LOGIN_EN = "Login please";
    public static final String MSG_UPDATE = "版本过旧请更新";
    public static final String MSG_UPDATE_EN = "App version is too old, please update";

    public static final String MSG_NO_AUTHORITY = "您没有权限访问此内容";

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    //whether success(for extjs)
    private boolean success;
    //response code
    private int code;
    //response message
    private String msg;
    //response data
    private Object data;

    public Response() {
    }

    public Response(int code, String msg, Object data) {
        this.success = code == CODE_SUCCESS;
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
